package androidx.test.espresso.action;

import android.view.View;
import android.widget.EditText;
import androidx.test.espresso.UiController;
import androidx.test.espresso.ViewAction;
import androidx.test.espresso.core.internal.deps.guava.base.Preconditions;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.espresso.remote.annotation.RemoteMsgConstructor;
import androidx.test.espresso.remote.annotation.RemoteMsgField;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

/* loaded from: classes.dex */
public final class ReplaceTextAction implements ViewAction {
    @RemoteMsgField(order = 0)
    final String stringToBeSet;

    @Override // androidx.test.espresso.ViewAction
    public String getDescription() {
        return "replace text";
    }

    @RemoteMsgConstructor
    public ReplaceTextAction(String value) {
        Preconditions.checkNotNull(value);
        this.stringToBeSet = value;
    }

    @Override // androidx.test.espresso.ViewAction
    public Matcher<View> getConstraints() {
        return Matchers.allOf(ViewMatchers.isDisplayed(), ViewMatchers.isAssignableFrom(EditText.class));
    }

    @Override // androidx.test.espresso.ViewAction
    public void perform(UiController uiController, View view) {
        ((EditText) view).setText(this.stringToBeSet);
    }
}
